<?php
/*  
  Copyright (c) 2010-02 SongCMS 
  SongCMS All Rights Reserved. 
  Support:www.SongCMS.com
  QQ:544255858   19951025
  Author:Song  Version:3.17
  Date:2010-08-12 09:28:32
*/

include_once('Admin.php');
if(empty($_GET['Module'])) $_GET['Module'] = 'product';
if(empty($_GET['Shape'])) $_GET['Shape'] = 'title';
//初始化
$aRow = 3;
$aColumn = 4;
$aWidth = 850;
$aDate = 'Y-m-d';
if($_GET['Shape'] == 'title'){
	if($_GET['Module'] == 'news'){$aRow  = 6; $aColumn = 2;}
	if($_GET['Module'] == 'product'){$aRow  = 3; $aColumn = 2; $aDate = NULL;}
	if($_GET['Module'] == 'page' || $_GET['Module'] == 'download'){$aRow  = 3; $aColumn = 2;}
}

if($_GET['Shape'] == 'photo'){
	if($_GET['Module'] == 'product' || $_GET['Module'] == 'news' || $_GET['Module'] == 'page'){$aWidth = 0; $aColumn = 3; $aRow  = 2;}
	
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="./images/adminstyle.css" rel="stylesheet" type="text/css" />
<link rel="Shortcut Icon" href="../favicon.ico">
<link rel="Bookmark" href="../favicon.ico">
<script src="../js/csshovernotie6.js" type="text/javascript"></script>
</head>
<body>
<br />
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr class="Notodd">
		<td><?php TopLang();?></td>
		<!--
		<td align="right"><strong>列表数据调用</strong> | <a href="CodeList.php?Lang=<?php echo $Lang;?>">内页数据调用</a> | <a href="CodeList.php?Lang=<?php echo $Lang;?>">调用自定义SQL</a> | <a href="CodeList.php?Lang=<?php echo $Lang;?>">基本数据调用</a> | <a href="CodeList.php?Lang=<?php echo $Lang;?>">其它数据调用</a></td>
		-->
	</tr>
</table>
<table width="98%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#CCCCCC">
	<form action="CodeForm.php?Lang=<?php echo $Lang;?>" method="post" name="form1" target="CodeForm" id="form1">
		<tr>
			<td colspan="3" align="center" class="Main_Title">模板调用代码生成器<?php echo $OnWebLangName?></td>
		</tr>
		<tr class="odd">
			<td height="20" align="right">调用模块：</td>
			<td><select name="Module" id="Module" onchange="window.open(this.options[this.selectedIndex].value,'_self')">
					<option <?php if($_GET['Module'] == 'system') echo 'selected="selected"';?> value="CodeList.php?Lang=<?php echo $Lang;?>&Module=system">系统基础数据及常用参数调用</option>
					<option <?php if($_GET['Module'] == 'product') echo 'selected="selected"';?> value="CodeList.php?Lang=<?php echo $Lang;?>&Module=product">产品模块</option>
					<option <?php if($_GET['Module'] == 'news') echo 'selected="selected"';?> value="CodeList.php?Lang=<?php echo $Lang;?>&Module=news">新闻模块</option>
					<option <?php if($_GET['Module'] == 'page') echo 'selected="selected"';?> value="CodeList.php?Lang=<?php echo $Lang;?>&Module=page">文章模块</option>
					<option <?php if($_GET['Module'] == 'download') echo 'selected="selected"';?> value="CodeList.php?Lang=<?php echo $Lang;?>&Module=download">下载数据</option>
					<option <?php if($_GET['Module'] == 'message') echo 'selected="selected"';?> value="CodeList.php?Lang=<?php echo $Lang;?>&Module=message">留言数据</option>
				</select>
			</td>
			<td>&nbsp;</td>
		</tr>
<?php if($_GET['Module'] != 'system'){?>		
		<tr class="odd">
			<td height="20" align="right">调用形式：</td>
			<td>
				<select name="Shape" id="Shape" onchange="window.open(this.options[this.selectedIndex].value,'_self')">
<?php
$options = $_GET['Shape'] == 'title' ? '<option selected="selected" ' : '<option ';
$options .= "value=\"CodeList.php?Lang={$Lang}&Module={$_GET['Module']}&Shape=title\">调用标题(名称)列表数据</option>";

if($_GET['Module'] != 'download' && $_GET['Module'] != 'message'){
	$options .= $_GET['Shape'] == 'photo' ? '<option selected="selected" ' : '<option ';
	$options .= "value=\"CodeList.php?Lang={$Lang}&Module={$_GET['Module']}&Shape=photo\">调用缩略图数据</option>";
	$options .= $_GET['Shape'] == 'detailed' ? '<option selected="selected" ' : '<option ';
	$options .= "value=\"CodeList.php?Lang={$Lang}&Module={$_GET['Module']}&Shape=detailed\">内页详细数据调用</option>";			
}
if($_GET['Module'] != 'message'){
	$options .= $_GET['Shape'] == 'class' ? '<option selected="selected" ' : '<option ';
	$options .= "value=\"CodeList.php?Lang={$Lang}&Module={$_GET['Module']}&Shape=class\">调用栏目分类(类别)</option>";
}
echo $options;
?>
				</select>
			</td>
			<td>&nbsp;</td>
		</tr>
<?php
//选择分类
if($_GET['Module'] != 'message' && $_GET['Shape'] != 'detailed'){
	echo '<tr class="odd"><td height="20" align="right">选择分类：</td><td><select name="Rela" id="Rela"><option value="0" selected="selected">== 全部类别 ==</option>	';
	switch ($_GET['Module']){
		case 'news'		: $ColumnType = 1; break; 
		case 'page'		: $ColumnType = 0; break; 
		case 'download'	: $ColumnType = 3; break; 
		default 		: $ColumnType = 2; break; 
	}
	$SQL = "SELECT * FROM `{$dbprefix}column` WHERE ColumnType = $ColumnType && ColumnLang = $Lang;";
	$ct = $db->SelectSQL($SQL,1);
	@$ct = sdb::column_sort($ct);
	foreach ($ct as $i => $n){
		$nbsps = NULL;
		for($x=1; $x<$n['ColumnLevel']; $x++){$nbsps .= '├┈┈';}
		echo "<option value=\"{$n['ID']}\">{$nbsps}{$n['ColumnName']}</option> \n";
	}
	echo '</select></td><td>选择调用全部或指定类别下的数据</td></tr>';
}
if($_GET['Shape'] != 'class' && $_GET['Shape'] != 'detailed'){
?>
		<tr class="odd">
			<td height="20" align="right">是否带分页：</td>
			<td>
				<input name="isPage" type="radio" value="1" />是
				<input name="isPage" type="radio" value="0" checked="checked" />否
			</td>
			<td>&nbsp;</td>
		</tr>
		<tr class="odd">
			<td height="20" align="right">显示数据行数：</td>
			<td><input name="Row" type="text" id="Row" value="<?php echo $aRow;?>" size="10" maxlength="5" /></td>
			<td>分页时为每页显示的数据条数</td>
		</tr>
<?php if($_GET['Module'] != 'message'){?>		
		<tr class="odd">
			<td height="20" align="right">显示数据列数：</td>
			<td><input name="Column" type="text" id="Column" value="<?php echo $aColumn;?>" size="10" maxlength="5" /></td>
			<td>是否多列显示</td>
		</tr>				
<?php }} if($_GET['Module'] != 'message' && $_GET['Shape'] != 'class' && $_GET['Shape'] != 'detailed'){?>
		<tr class="odd">
			<td height="20" align="right">搜索结果：</td>
			<td>
				<input name="isSearch" type="radio" id="radio" value="0" checked="checked" />不显示
				<input name="isSearch" type="radio" id="radio" value="1" />显示
			 </td>
			<td>选择"显示"可以与搜索结果页共用</td>
		</tr>
<?php if($_GET['Shape'] == 'title'){?>		
		<tr class="odd">
			<td height="20" align="right">热点图标：</td>
			<td><input name="Hot" type="text" id="Hot" value="10" size="10" maxlength="5" /><img src="../images/hot.gif" width="26" height="10" /></td>
			<td>当<?php if($_GET['Module'] == 'download'){echo '下载';} else {echo '点击';} ?>次数大于该值时显示，为0时不显示</td>
		</tr>
		<tr class="odd">
			<td height="20" align="right">最新图标：</td>
			<td><input name="New" type="text" id="New" value="48" size="10" maxlength="5" /><img src="../images/new.gif" width="24" height="9" /></td>
			<td>小时，发布后多少小时内显示，为0时不显示</td>
		</tr>
		<tr class="odd">
			<td height="20" align="right">显示类别：</td>
			<td><input name="Show" type="text" id="Show" value="1" size="10" maxlength="10" /></td>
			<td>是否显示类别名称，-1不显示，0显示多级类别名称，其它数字为指定的类别级数。如2，显示该内容所属的二级类别名称</td>
		</tr>
		<tr class="odd">
			<td height="20" align="right">标题前缀图标：</td>
			<td><input name="Prefix" type="text" id="Prefix" value="common5.gif" size="20" maxlength="50" /></td>
			<td>位于网站 images 目录下图片文件名称，留空为不显示前缀图标</td>
		</tr>
		<tr class="odd">
			<td height="20" align="right" id="doin">是否显示<?php if($_GET['Module'] == 'download'){echo '下载';} else {echo '点击';} ?>次数：</td>
			<td>
				<input name="Click" type="radio" value="1" checked="checked" />是
				<input name="Click" type="radio" value="0" />否
			</td>
			<td><?php if($_GET['Module'] != 'download'){ ?>开通静态时无效<?php }?></td>
		</tr>
		<tr class="odd">
			<td height="20" align="right">发布日期/时间：</td>
			<td><input name="Date" type="text" id="Date" value="<?php echo $aDate;?>" size="20" maxlength="50" /></td>
			<td>留空时不显示，格式：Y=年,m=月,d=日,H=时,i=分,s=秒</td>
		</tr>
		<tr class="odd">
			<td height="20" align="right">间隔线：</td>
			<td>
				<input name="Interval" type="radio" value="2" checked="checked" />线型
				<input name="Interval" type="radio" value="1" />实线
				<input name="Interval" type="radio" value="0" />无
			</td>
			<td>每行之间的间隔线，线型默认采用 images/0101.gif 图片文件,使用其它图片文件或改变实线的颜色请直接修改生成后的代码</td>
		</tr>			
<?php } else {?>
		<tr class="odd">
			<td height="20" align="right">排列方式：</td>
			<td>
				<input name="Layout" type="radio" value="0" checked="checked" />缩略图位于文字上方
				<input name="Layout" type="radio" value="1" />缩略图靠左
			</td>
			<td>&nbsp;</td>
		</tr>
		<tr class="odd">
			<td height="20" align="right">缩略图宽：</td>
			<td><input name="imgwidth" type="text" id="imgwidth" value="120" size="10" maxlength="5" /></td>
			<td>&nbsp;</td>
		</tr>
		<tr class="odd">
			<td height="20" align="right">缩略图高：</td>
			<td><input name="imgheight" type="text" id="imgheight" value="100" size="10" maxlength="5" /></td>
			<td>&nbsp;</td>
		</tr>
<?php } if(($_GET['Module'] == 'product' || $_GET['Module'] == 'news'|| $_GET['Module'] == 'page') && ($_GET['Shape'] != 'detailed' || $_GET['Shape'] != 'class')){?>
		<tr class="odd">
			<td height="20" align="right">只调用含有缩略图：</td>
			<td>
				<input name="Abbre" type="radio" value="1" />是
				<input name="Abbre" type="radio" value="0" checked="checked" />否			
			</td>
			<td>否，调用全部。是，只调用带有缩略图的数据</td>
		</tr>
<?php }?>		
		<tr class="odd">
			<td height="20" align="right">表格宽度：</td>
			<td><input name="Width" type="text" id="Width" value="<?php echo $aWidth;?>" size="10" maxlength="10" /></td>
			<td>为0时自动宽度</td>
		</tr>
		<tr class="odd">
			<td height="20" align="right">行高：</td>
			<td><input name="Height" type="text" id="Height" value="20" size="10" maxlength="10" /></td>
			<td>&nbsp;</td>
		</tr>
		<tr class="odd">
			<td height="20" align="right">间距：</td>
			<td><input name="Spacing" type="text" id="Spacing" value="5" size="10" maxlength="5" /></td>
			<td>&nbsp;</td>
		</tr>		
		<tr class="odd">
			<td height="20" align="right">起始数据：</td>
			<td><input name="Start" type="text" id="Start" value="0" size="10" maxlength="5" /></td>
			<td> 不分页时有效，0 为从第一条记录开始调用，以此类推。方便同一页在不同的位置多次调用相同模块的数据。<br />
				如：在首页左侧调用第1至3个最新产品，在页面右侧从第3个最新产品开始再调用3个产品 </td>
		</tr>
		<tr class="odd">
			<td height="20" align="right">标题最大字节数：</td>
			<td><input name="Character" type="text" id="Character" value="10" size="10" maxlength="5" /></td>
			<td>设置当标题长度超过本设定时，是否将标题自动截取到本设定中的字节数，0 为不自动缩减</td>
		</tr>
		<tr class="odd">
			<td height="20" align="right">标题后缀字符：</td>
			<td><input name="Suffix" type="text" id="Suffix" value="..." size="20" maxlength="50" /></td>
			<td>当标题字符数超出最大字节数限制时被截取后显示，留空时不显示</td>
		</tr>

		<tr class="odd">
			<td height="20" align="right">排序方式：</td>
			<td><select name="Sort" id="Sort">
					<option value="1" selected="selected">按发布(添加)时间降序</option>
					<option value="4">按发布(添加)时间升序</option>
					<?php if($_GET['Module'] == 'download'){?>
					<option value="5">按下载次数降序</option>
					<?php } else {?>
					<option value="0">按排序字段指定值降序</option>
					<option value="2">按点击次数降序</option>
					<option value="3">按推荐优先</option>					
					<?php }?>
				</select></td>
			<td>&nbsp;</td>
		</tr>
		<tr class="odd">
			<td height="20" align="right">链接打开方式：</td>
			<td><select name="Target" id="Target">
					<option value="_self">当前窗口</option>
					<option value="_blank">新窗口</option>
				</select></td>
			<td>&nbsp;</td>
		</tr>
<?php } }?>		
		<tr class="odd">
			<td height="20" align="right">可用页面：</td>
			<td colspan="2">
<?php
$xText = '全部';
if($_GET['Module'] == 'download' && $_GET['Shape'] == 'title'){
		$xText = "index{$TemplateSuffix},download{$TemplateSuffix} 或其它自定义模板文件";
}
if($_GET['Module'] == 'message') $xText = "index{$TemplateSuffix},guestbook{$TemplateSuffix} 或其它自定义模板文件";
if($_GET['Shape'] == 'detailed'){
	switch ($_GET['Module']){
		case 'product'	: $xText = "product{$TemplateSuffix} 或其它自定义模板文件"; break;
		case 'news'	: $xText = "new{$TemplateSuffix} 或其它自定义模板文件"; break;
		case 'page'	: $xText = "page{$TemplateSuffix},case_detail{$TemplateSuffix} 或其它自定义模板文件"; break;
	}
}
echo "此次调用代码可用于以下模板页：<font color=\"#0033CC\">{$xText}</font>";
?>			
				
			</td>
		</tr>
		<tr class="odd">
			<td height="20" align="right">&nbsp;</td>
			<td colspan="2">
				<?php
				// 转 Get 为 Post
				foreach($_GET as $i => $n){
					echo "<input type=\"hidden\" name=\"{$i}\" value=\"$n\" />";
				}		
				?>
				<input type="hidden" name="a" value="CodeForm" />
				<input type="submit" name="button" id="button" value="生成调用代码" style="width:120px; height:28px;" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="button" name="xxxnew" value="刷新数据" style="width:120px; height:28px;" onClick="javascript:location.href='CodeList.php?Lang=<?php echo $Lang;?>'">
			</td>
		</tr>
	</form>
</table>
<iframe src="CodeForm.php?Lang=<?php echo $Lang;?>" width="100%" scrolling="no" frameborder="0" name="CodeForm" id="CodeForm"></iframe>
</body>
</html>